﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;

namespace ThreadExp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        public void Beta()
        {
            while (true)
            {
                txtOutput.Text+="Alpha.Beta is running in its own thread."+"\r\n";
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Thread oThread = new Thread(new ThreadStart(Beta));
            oThread.Start();
            while (!oThread.IsAlive)
                Thread.Sleep(1000);
           // oThread.Abort();
          //  oThread.Join();
            txtOutput.Text+="ssss";

            //txtOutput.Text = Thread.CurrentThread.Name + " Status:" + Thread.CurrentThread.ThreadState;
            
        }
    }
}
